<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/pages/common.jsp" %>
<%@ include file="/common/pages/taglibs.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="ex" uri="/ex"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=basePath%>/common/js/jquery-ui/themes/smoothness/jquery-ui.css">
<script type="text/javascript" src="<%=basePath%>/common/js/jquery-ui/jquery.ui.js"></script>
<script type="text/javascript" src="<%=basePath%>iccard/js/combocard_add.js"></script>
<title>combocard list</title>
</head>
<body>
	<input value="<%=basePath%>" id="contextPath" type="hidden"/>
	<input value="${comboCard.comboCardName}" id="oldcomboCardName" type="hidden"/>
	<form id="combocard_form" method="post"
	action="<%=basePath%>iccard/combocard/${nextaction}"
	onsubmit="">
	<input type="hidden" id="comboCardId" name="comboCardId" value="${comboCard.comboCardId}" />
	<div id="combocardset" class="easyui-panel" nofit=true
		style="padding: 2px; border: 1px solid #ddd;" title="${formtitle}套餐卡"
		data-options="iconCls:'icon-bt',collapsible:true">
		<table width="90%">
			<tr>
				<td><font color="red">*</font>套餐名称：</td>
				<td><input class="easyui-validatebox" validType="checkCardName"
					data-options="required:true,validType:'maxLength[32]'" name="comboCardName" id="comboCardName"
					value="<c:out value="${comboCard.comboCardName}"/>" style="width: 200px" maxlength="32" ${param.readonly}/>
				</td>
			</tr>
			<tr>
				<td><font color="red">*</font>套餐开始时间：</td>
				<td>
				<input class="easyui-datebox" missingMessage="日期必须填写" validType="checkSt" editable="false" name="begintime" id="begintime" data-options="required:true,validType:'date'" value='<fmt:formatDate value="${comboCard.begintime}" pattern="yyyy-MM-dd"/>' />
				</td>
				<td><font color="red">*</font>套餐结束时间：</td>
				<td><input class="easyui-datebox" missingMessage="日期必须填写"  editable="false"  name="endtime" id="endtime" data-options="required:true,validType:'date'"  value='<fmt:formatDate value="${comboCard.endtime}" pattern="yyyy-MM-dd"/>'/>
				</td>
			</tr>
			<tr>
				<td>套餐简介：</td>
				<td><textarea name="comboCardIntro"  class="easyui-validatebox" data-options="validType:'maxLength[512]'"
						style="height: 60px; width: 300px; font-size: 13px"  maxlength="512"
						${param.readonly}
						name="comboCardIntro"><c:out value="${comboCard.comboCardIntro}"/></textarea>
				</td>
			</tr>
		</table>

	</div>

	<div id="nrqx" class="easyui-panel" nofit=true
		data-options="title:'商户',iconCls:'icon-bt',collapsible:true,tools:'#tt'">
		
		<div id="merctDiv" >
		
		<c:if test="${nextaction eq 'add'}">
			<div class="easyui-panel" style="margin-top: 5px;">
				<table width="90%">
					<tr>
						<td><font color="red">*</font>活动商户<strong id="pp">1</strong>：</td>
						<td>
							<select id="merchantId" data-options="required:false" class="merchantId" style="width:300px;" name="comboCardProductDetails[0].merchantId" ></select>
						</td>
						<td align="right" colspan=3><a id="delm" href="#" class="easyui-linkbutton" onclick="javascript:delm(this);">删除添加商户商品</a></td>
					</tr>
					<tr>
						<td><font color="red">*</font>涉及商品：</td>
						<td><input class="easyui-validatebox"
							data-options="required:true"  maxlength="512" name="comboCardProductDetails[0].productNames"
							value="" style="width: 200px" />
						</td>
						<td width="100px"></td>
						<td><font color="red">*</font>原价格：</td>
						<td><input class="easyui-validatebox" validType="checkyjg[0]"
							data-options="required:true" name="comboCardProductDetails[0].productOrignalPrice"
							value="" style="width: 200px" maxlength="10" onchange="merchantChange(this);" />
						</td>
					</tr>
					<tr>
						<td><font color="red">*</font>优惠价格：</td>
						<td><input class="easyui-validatebox" validType="checkyhjg[0]"
							data-options="required:true" name="comboCardProductDetails[0].productFavorablePrice"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);"/>
						</td>
						<td></td>
						<td><font color="red">*</font>销售价格：</td>
						<td><input class="easyui-validatebox" validType="checkxsjg[0]"
							data-options="required:true" name="comboCardProductDetails[0].productSalePrice"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);" />
						</td>
					</tr>
					<tr>
						<td><font color="red">*</font>销售总份数：</td>
						<td><input class="easyui-validatebox" validType="positiveInt"
							data-options="required:true" name="comboCardProductDetails[0].productCopies"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);" />
						</td>
						<td></td>
						<td>加价百分比：</td>
						<td><input class="easyui-validatebox" readonly="readonly" validType="jabfb"
							data-options="required:true" name="comboCardProductDetails[0].productRaisePriceRate"
							value="" style="width: 80px" maxlength="10" ${param.readonly}/>%
							
						</td>
					</tr>
				</table>
			</div>
			</c:if>
			<c:if test="${nextaction eq 'update'}">
			<c:forEach items="${comboCard.comboCardProductDetails}" var="list"  varStatus="status"> 
				<div class="easyui-panel">
				<table width="90%">
					<tr>
						<td><font color="red">*</font>活动商户<pp>${status.index+1}</pp>：</td>
						<td>
							<select id="merchantId" class="merchantId" sval="${list.merchantId}" name="comboCardProductDetails[${status.index}].merchantId" style="width:300px;"></select> 
						</td>
						<td align="right" colspan=3><a id="delm" href="#" class="easyui-linkbutton" onclick="javascript:delm(this);">删除添加商户商品</a></td>
					</tr>
					<tr>
						<td><font color="red">*</font>涉及商品：</td>
						<td><input class="easyui-validatebox"
							data-options="required:true,validType:'maxLength[512]'"  maxlength="512" value="${list.productNames}" name="comboCardProductDetails[${status.index}].productNames"
							value="" style="width: 200px" />
						</td>
						<td width="100px"></td>
						<td><font color="red">*</font>原价格：</td>
						<td><input class="easyui-validatebox" validType="checkyjg[${status.index}]"
							data-options="required:true" value="${list.productOrignalPrice}" name="comboCardProductDetails[${status.index}].productOrignalPrice"
							value="" style="width: 200px" maxlength="10" onchange="merchantChange(this);" />
						</td>
					</tr>
					<tr>
						<td><font color="red">*</font>优惠价格：</td>
						<td><input class="easyui-validatebox" validType="checkyhjg[${status.index}]"
							data-options="required:true,validType:'number'" value="${list.productFavorablePrice}" name="comboCardProductDetails[${status.index}].productFavorablePrice"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);"/>
						</td>
						<td></td>
						<td><font color="red">*</font>销售价格：</td>
						<td><input class="easyui-validatebox" validType="checkxsjg[${status.index}]"
							data-options="required:true" value="${list.productSalePrice}" name="comboCardProductDetails[${status.index}].productSalePrice"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);" />
						</td>
					</tr>
					<tr>
						<td><font color="red">*</font>销售总份数：</td>
						<td><input class="easyui-validatebox" validType="positiveInt"
							data-options="required:true" value="${list.productCopies}" name="comboCardProductDetails[${status.index}].productCopies"
							value="" style="width: 200px" maxlength="10" ${param.readonly} onchange="merchantChange(this);" />
						</td>
						<td></td>
						<td>加价百分比：</td>
						<td><input class="easyui-validatebox" readonly="readonly" validType="jabfb"
							data-options="required:true" value="${list.productRaisePriceRate}" name="comboCardProductDetails[${status.index}].productRaisePriceRate"
							value="" style="width: 80px" maxlength="10" ${param.readonly}/>%
							<input value="${list.comboCardProductDetailId}" name="comboCardProductDetails[${status.index}].comboCardProductDetailId"  type="hidden"/>
						</td>
					</tr>
				</table>
			</div>
			</c:forEach>
			</c:if>
		</div>
		<div>
			<div style="padding: 10px 0 10px 10px"><a href="#" class="easyui-linkbutton" onclick="addm()">继续添加商户商品</a></div>
		</div>
	</div>
	
	<div id="combocardtol" class="easyui-panel" nofit=true
		style="padding: 2px; border: 1px solid #ddd;" title=""
		data-options="iconCls:'icon-bt',collapsible:true">
		<table width="90%">
			<tr>
				<td>原总价格：</td>
				<td><input class="easyui-validatebox"
					name="comboCardOrignalPrice" id="comboCardOrignalPrice"
					value="<c:out value="${comboCard.comboCardOrignalPrice}"/>" style="width: 200px" readonly="readonly" />
				</td>
				<td>原优惠价格：</td>
				<td><input class="easyui-validatebox"
					name="comboCardFavorablePrice" id="comboCardFavorablePrice"
					value="<c:out value="${comboCard.comboCardFavorablePrice}"/>" style="width: 200px" readonly="readonly" />
				</td>
			</tr>
			<tr>
				<td>套餐销售价格：</td>
				<td>
				<input class="easyui-validatebox"
					name="comboCardSalePrice" id="comboCardSalePrice"
					value="<c:out value="${comboCard.comboCardSalePrice}"/>" style="width: 200px" readonly="readonly" />
				</td>
				<td>套餐加价百分比：</td>
				<td>
				<input class="easyui-validatebox"
					name="comboCardRaisePriceRate" id="comboCardRaisePriceRate"
					value="<c:out value="${comboCard.comboCardRaisePriceRate}"/>" style="width: 80px" readonly="readonly" />%
				</td>
			</tr>
			<tr>
				<td>可销售总份数：</td>
				<td>
				<input class="easyui-validatebox"
					name="comboCardTotalCopies" id="comboCardTotalCopies"
					value="<c:out value="${comboCard.comboCardTotalCopies}"/>" style="width: 200px" readonly="readonly" />
				</td>
				<td>总折扣：</td>
				<td><input class="easyui-validatebox"
					name="totalDiscount" id="totalDiscount"
					value="<c:out value="${comboCard.totalDiscount}"/>" style="width: 80px" readonly="readonly" />%
				</td>
			</tr>
		</table>

	</div>
</form>
<c:set var="showdiv" value="" />
<c:if test="${not empty param.readonly}">
	<c:set var="showdiv" value="none" />
</c:if>
<div id="btn_div"
	style="display: ${showdiv};text-align:center;margin-top:10px">
	<c:if test="${nextaction eq 'update'}">
			<a id="saveb" href="#" class="easyui-linkbutton" onclick="saveCombo();">保存</a>
			<a href="#" class="easyui-linkbutton" onclick="back()">取消</a>
	</c:if>
	<c:if test="${nextaction eq 'add'}">
			<a id="saveb" href="#" class="easyui-linkbutton" onclick="saveCombo();">保存</a>
			<a href="#" class="easyui-linkbutton" onclick="back()">取消</a>
	</c:if>
</div>
</body>
</html>